package com.jiangjiang.eshop.wms.chain;

import com.jiangjiang.eshop.purchase.service.PurchaseFacadeService;
import com.jiangjiang.eshop.wms.dto.PurchaseInputOrderDTO;
import com.jiangjiang.eshop.wms.dto.PurchaseInputOrderHandlerResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author Jianghaowen
 * @Date 2021/9/14
 * @Description: TODO
 * @Version V1.0
 **/
@Component
public class InformPurchaseCenterHandler extends AbstractPurchaseInputOrderHandler {

    @Autowired
    private PurchaseFacadeService purchaseFacadeService;

    /**
     * 执行采购中心状态变更逻辑
     * @param dto 采购入库单
     * @return
     */
    @Override
    protected PurchaseInputOrderHandlerResult doExecute(PurchaseInputOrderDTO dto) {
        purchaseFacadeService.informFinishedPurchaseInputOrderEvent(dto.getPurchaseOrderId());
        return new PurchaseInputOrderHandlerResult(true);
    }
}
